<?php
class Home extends Doctrine_Record {
    public function setTableDefinition() {
        $this->setTableName('home');
    }
    
    //IMAGENES
    public function getImagenes () {
        $q = Doctrine_Query::create()
            ->select('i.*')
            ->from('Imagen i')
            ->where('i.id_generic_object = '.$this->id)
            ->andWhere('i.tabla = "home"')
            ->orderBy('i.orden');
        return $q->execute();
    }
    
    public function addImagen ($imagen) {
        $imagen->id_generic_object = $this->id;
        $imagen->tabla = 'home';
        $imagen->save();
    }
    //FIN IMAGENES
    
    public static function getInstance () {
        return Doctrine::getTable('home')->find(1);
    }
}
?>